package com.lemontree.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lemontree.utils.DBUtils;

/**
 * Servlet implementation class CarInfoAddServlet
 */
public class BicyleInfoAddServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public BicyleInfoAddServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(request, response);
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub

		String address=request.getParameter("address");
		String number=request.getParameter("number");
		String x=request.getParameter("x");
		String y=request.getParameter("y");
		
		DBUtils db=new DBUtils();
		String sql="INSERT INTO bicyleinfo (state,bicyleCount,maxbicylecount,address,X,Y)VALUES(0,0,"+number+",'"+address+"','"+x+"','"+y+"')";
		
		int n=db.update(sql);

	
	}

}
